package components.decoration;

import java.awt.Color;
import java.awt.Font;

import com.uqbar.vainilla.DeltaState;
import com.uqbar.vainilla.GameComponent;
import com.uqbar.vainilla.appearances.Label;

public class ExpirableLabel extends GameComponent {

	private double expiresOn;
	private double currentSeconds;
	
	
	public ExpirableLabel(String text, Font font, Color color, double secondsToExpire, double x, double y){
		super(x, y);
		this.setZ(10);
		this.expiresOn = secondsToExpire;
		this.currentSeconds = 0;
		Label label = new Label(font, color, text);
		this.setAppearance(label);
	}
	
	public void update(DeltaState delta){
		this.currentSeconds += delta.getDelta();
		if (currentSeconds > this.expiresOn){
			this.destroy();
		}
	}
}
